package com.zh.note.huawei.onehundred.非严格递增连续数字序列;

/**
 * @Author: zhanghuan
 * @date: 2023/9/2 18:13
 * @description: create it
 */
public class Main {
    public static void main(String[] args) {
        // Scanner sc = new Scanner(System.in);
        // String line = sc.nextLine();
        String line = "abc2234019A334bc";
        solution(line);
    }

    private static void solution(String line) {
        int curLen = 0;
        int maxLen = Integer.MIN_VALUE;
        char preDigit = '0';
        char[] chars = line.toCharArray();
        for (char ch : chars) {
            if (Character.isDigit(ch)) { // 找到数字
                if (ch >= preDigit) {
                    curLen++;
                } else {
                    maxLen = Math.max(maxLen, curLen);
                    curLen = 1;
                }
                preDigit = ch;

            } else {//不是数字
                maxLen = Math.max(maxLen, curLen);
                curLen = 0;
                preDigit = '0';
            }
        }
        maxLen = Math.max(maxLen, curLen);
        System.out.println(maxLen);
    }
}
